<?php
class pagination_ctr extends CI_Controller 
{
    public function __construct() {
        parent:: __construct();
        $this->load->helper("url");
        $this->load->model("pagination_mdl");
        $this->load->library("pagination");
		
    }
 
    public function index() {
        $config = array();
        $config["base_url"] = base_url() . "pagination_ctr/index";
        $config["total_rows"] = $this->pagination_mdl->record_count();
        $config["per_page"] = 20;
        $config["uri_segment"] = 3;
        $num_article=2;
        $this->pagination->initialize($config);
 
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        $data["results"] = $this->pagination_mdl->
           get_all2($config["per_page"], $page,$num_article);
        $data["links"] = $this->pagination->create_links();
 
        $this->load->view("pgination_vew",$data);
    }
	
	public function test_pagination() {
        $config = array();
        $config["base_url"] = base_url() . "pagination_ctr/test_pagination";
        $config["total_rows"] = $this->pagination_mdl->record_count();
        $config["per_page"] = 20;
        $config["uri_segment"] = 3;
        $num_article=2;
        $this->pagination->initialize($config);
 
        $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
        $data["results"] = $this->pagination_mdl->
           get_all2($config["per_page"], $page,$num_article);
        $data["links"] = $this->pagination->create_links();
 
        $this->load->view("pagination_vew", $data);
    }
}